import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

import java.util.List;
import java.util.concurrent.TimeUnit;

public class Test01 {
    public static void main(String[] args) throws InterruptedException {
        test01();
    }

    private static void test01() throws InterruptedException {

        WebDriver webDriver = new ChromeDriver();
        webDriver.get("http://127.0.0.1:8080/blog_system/login.html");
        webDriver.findElement(By.name("username")).sendKeys("lisi");
        webDriver.findElement(By.id("password")).sendKeys("123");
        webDriver.findElement(By.xpath("//*[@id=\"submit\"]")).submit();
        String currentUrl = webDriver.getCurrentUrl();

        if(currentUrl.equals("http://127.0.0.1:8080/blog_system/blog_list.html"))
        {
            System.out.println("测试通过");
        }
   List<WebElement> list = webDriver.findElements(By.className("title"));
        System.out.println(list.size());
       Thread.sleep(3000);
        webDriver.findElement(By.linkText("查看全文 >>")).click();

    }
}
